package cn.rubintry.bug.hunting.room.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import cn.rubintry.bug.hunting.pojo.ArticleTagTable


@Dao
interface ArticleTagDao {

    /**
     * 插入文章和标签的关联
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertArticle(vararg articleTag: ArticleTagTable)

    @Query("SELECT * FROM ArticleTagTable WHERE tagId=(:tagId)")
    fun selectByTag(tagId: String) : List<ArticleTagTable>

    @Query("DELETE FROM ArticleTagTable WHERE tagId=(:tagId)")
    fun deleteById(tagId: String)
}